package scan.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.DependsOn;
import scan.pojo.Klass;
import scan.pojo.Student;
import scan.server.impl.School;

import java.util.ArrayList;
import java.util.List;

@Configuration
public class SchoolAutoConfiguration {
    private Student student;
    private Klass klass;
    @Bean("student100")
    public Student student()
    {
        Student student = new Student();
        student.setId(1);
        student.setName("Stephanie");
        this.student=student;
        return student;
    }
    @Bean
    @DependsOn("student100")
    public Klass klass()
    {
        Klass klass = new Klass();
        List<Student> list=new ArrayList<>();
        list.add(student);
        klass.setStudents(list);
        return klass;
    }
    @Bean
    @DependsOn({"student100","klass"})
    public School iSchool()
    {
        School school=new School();
        return school;
    }
}
